[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 signal()                Specify Signal Handler

 #include   <signal.h>

 void (*signal(signl, void (*func) signl[,subcode])))(int);
 int signl;     Type of signal you intend to handle
 int subcode;   Signal subcode

        This function lets you install a function to handle signal events
        such as abnornal termination or arithmetic errors. You can either
        install your own function or use one of these defaults:

                    SIG_DFL     Default action
                    SIG_IGN     Ignore action
                    SIG_ERR     Error return

        The possible signals to intercept are:

                    SIGABRT     Abnormal termination
                    SIGFPE      Floating point error
                    SIGILL      Illegal instruction
                    SIGINT       nterrupt
                    SIGSEGV     Illegal storage access
                    SIGTERM     Request for program termination

       Returns:     A pointer to the previous handler if successful;
                    SIG_ERR otherwise.

   -------------------------------- Example ---------------------------------

        This example installs a signal handler routine for SIGFPE,
        and prints: "Floating Point Error!" when it is called.

 #include <stdio.h>
 #include <signal.h>

 void Handler(int *reglist)

    printf("Floating Point Error!\n");


 int main(void)

    signal(SIGFPE, Handler);
    return 0;



See Also: abort() longjmp() raise() setjmp()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson